package com.xx.happychatboot.serve.user.mapper;

import com.xx.happychatboot.serve.user.domain.entity.SysUserInfo;
import com.xx.happychatboot.serve.user.domain.vo.response.AddUserResponse;
import io.mybatis.mapper.Mapper;
import io.mybatis.mapper.base.EntityProvider;
import io.mybatis.provider.Caching;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaoXuan
 * @since 2024-12-10
 */
public interface SysUserInfoMapper extends Mapper<SysUserInfo, Long> {

    /**
     * 保存
     * @param userInfo
     */
    void insertUserInfo(SysUserInfo userInfo);

    @Override
    @Lang(Caching.class)
    @Options(useGeneratedKeys = true, keyProperty = "userInfoId")
    @InsertProvider(type = EntityProvider.class, method = "insert")
    <S extends SysUserInfo> int insert(S entity);

    @Override
    @Lang(Caching.class)
    @Options(useGeneratedKeys = true, keyProperty = "userInfoId")
    @InsertProvider(type = EntityProvider.class, method = "insert")
    <S extends SysUserInfo> int insertSelective(S entity);

    List<AddUserResponse> searchUserByUserName(@Param("userName") String userName);
}
